package xgenerator.generators.jgenerator.impl;

import java.io.File;

import xgenerator.generators.JSGenerator;
import xgenerator.generators.jgenerator.JSPGenerator;
import xgenerator.generators.jgenerator.JWebAppGenerator;
import xgenerator.generators.jgenerator.S2SH;
import xgenerator.model.ModelMetadata;
import xgenerator.util.StringUtils;

/**
 * <p>
 * Title:Struts23Spring256Hibernate36JspGenerator
 * </p>
 * <p>
 * Description:具体功能见各方法描述
 * </p>
 * <p>
 * Copyright:Copyright (c) 2012
 * </p>
 * 
 * @author <a href="mailto:lishushan@gmail.com">liss</a>
 * @version 1.0
 */
public class Struts23Spring256Hibernate36JspGenerator extends JWebAppGenerator implements S2SH, JSPGenerator, JSGenerator {
	
	/**
	 * /jdk1.5_struts-2.3.x_spring-2.5.x_hibernate-3.x_JSP
	 */
	public static final String TEMPLATE_PATH = "/jdk1.5_struts-2.3.x_spring-2.5.x_hibernate-3.x_JSP";
	
	/**
	 * /jdk1.5_struts-2.3.x_spring-2.5.x_hibernate-3.x_JSP/java
	 */
	public static final String JAVA_TEMPLATE_PATH = TEMPLATE_PATH + "/java";

	/**
	 * /jdk1.5_struts-2.3.x_spring-2.5.x_hibernate-3.x_JSP/jsp
	 */
	static final String JSP_TEMPLATE_PATH = TEMPLATE_PATH + "/jsp";
	
	/**
	 * /jdk1.5_struts-2.3.x_spring-2.5.x_hibernate-3.x_JSP/xml
	 */
	public static final String XML_TEMPLATE_PATH = TEMPLATE_PATH + "/xml";
	
	/**
	 * <p>
	 * Title：生成表示层代码
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.ViewGenerator#generateViewCode(xgenerator.model.ModelMetadata)
	 */
	public String generateViewCode(ModelMetadata modelMetadata) {
		StringBuffer codes = new StringBuffer();
		
		String createPageCode = generateCreatePageCode(modelMetadata);
		if(StringUtils.isNotBlank(createPageCode)) {
			codes.append("&").append(createPageCode);
		}
		
		String editPageCode = generateEditPageCode(modelMetadata);
		if(StringUtils.isNotBlank(editPageCode)) {
			codes.append("&").append(editPageCode);
		}
		
		String viewPageCode = generateViewPageCode(modelMetadata);
		if(StringUtils.isNotBlank(viewPageCode)) {
			codes.append("&").append(viewPageCode);
		}
		
		String gridPageCode = generateGridPageCode(modelMetadata);
		if(StringUtils.isNotBlank(gridPageCode)) {
			codes.append("&").append(gridPageCode);
		}
		
		String jsCode = generateJsCode(modelMetadata);
		if(StringUtils.isNotBlank(jsCode)) {
			codes.append("&").append(jsCode);
		}
		
		return codes.toString();
	}

	/**
	 * <p>
	 * Title：生成CreatePage代码
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.JSPGenerator#generateCreatePageCode(xgenerator.model.ModelMetadata)
	 */
	public String generateCreatePageCode(ModelMetadata modelMetadata) {
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String modulePackagePath = buildPackagePath(modelMetadata.getModule());
		String createPageFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getWebRoot() + File.separator + subsystemPackagePath + File.separator + modulePackagePath + File.separator + modelMetadata.getJavaModelNameLowerCase();
		String createPageFileName = modelMetadata.getCreatePrefix() + modelMetadata.getJavaModelNameUpperCamelCase() + JSP_EXT;
		
		String template = JSP_TEMPLATE_PATH + "/CreatePage.ftl";
		return "@" + generateCode(modelMetadata, template, createPageFilePath, createPageFileName);
	}

	/**
	 * <p>
	 * Title：生成EditPage代码
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.JSPGenerator#generateEditPageCode(xgenerator.model.ModelMetadata)
	 */
	public String generateEditPageCode(ModelMetadata modelMetadata) {
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String modulePackagePath = buildPackagePath(modelMetadata.getModule());
		String editPageFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getWebRoot() + File.separator + subsystemPackagePath + File.separator + modulePackagePath + File.separator + modelMetadata.getJavaModelNameLowerCase();
		String editPageFileName = modelMetadata.getEditPrefix() + modelMetadata.getJavaModelNameUpperCamelCase() + JSP_EXT;
		
		String template = JSP_TEMPLATE_PATH + "/EditPage.ftl";
		return "@" + generateCode(modelMetadata, template, editPageFilePath, editPageFileName);
	}

	/**
	 * <p>
	 * Title：生成ViewPage代码
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.JSPGenerator#generateViewPageCode(xgenerator.model.ModelMetadata)
	 */
	public String generateViewPageCode(ModelMetadata modelMetadata) {
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String modulePackagePath = buildPackagePath(modelMetadata.getModule());
		String viewPageFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getWebRoot() + File.separator + subsystemPackagePath + File.separator + modulePackagePath + File.separator + modelMetadata.getJavaModelNameLowerCase();
		String viewPageFileName = modelMetadata.getViewPrefix() + modelMetadata.getJavaModelNameUpperCamelCase() + JSP_EXT;
		
		String template = JSP_TEMPLATE_PATH + "/ViewPage.ftl";
		return "@" + generateCode(modelMetadata, template, viewPageFilePath, viewPageFileName);
	}

	/**
	 * <p>
	 * Title：生成GridPage代码
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.JSPGenerator#generateGridPageCode(xgenerator.model.ModelMetadata)
	 */
	public String generateGridPageCode(ModelMetadata modelMetadata) {
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String modulePackagePath = buildPackagePath(modelMetadata.getModule());
		String gridPageFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getWebRoot() + File.separator + subsystemPackagePath + File.separator + modulePackagePath + File.separator + modelMetadata.getJavaModelNameLowerCase();
		String gridPageFileName = modelMetadata.getJavaModelNameLowerCamelCase() + modelMetadata.getGridSuffer() + JSP_EXT;
		
		String template = JSP_TEMPLATE_PATH + "/GridPage.ftl";
		return "@" + generateCode(modelMetadata, template, gridPageFilePath, gridPageFileName);
	}
	
	/**
	 * <p>
	 * Title：生成Js代码
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.JSGenerator#generateJsCode(xgenerator.model.ModelMetadata)
	 */
	public String generateJsCode(ModelMetadata modelMetadata) {
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String modulePackagePath = buildPackagePath(modelMetadata.getModule());
		String jsFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getWebRoot() + File.separator + subsystemPackagePath + File.separator + modulePackagePath + File.separator + modelMetadata.getJavaModelNameLowerCase() + File.separator + "js";
		String jsFileName = modelMetadata.getJavaModelNameLowerCamelCase() + JS_EXT;
		
		String template = JSP_TEMPLATE_PATH + "/JS.ftl";
		return "@" + generateCode(modelMetadata, template, jsFilePath, jsFileName);
	}
	
	/**
	 * <p>
	 * Title：生成控制层代码
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.ControllerGenerator#generateControllerCode(xgenerator.model.ModelMetadata)
	 */
	public String generateControllerCode(ModelMetadata modelMetadata) {
		StringBuffer codes = new StringBuffer();
		
		String actionCode = generateActionCode(modelMetadata);
		if(StringUtils.isNotBlank(actionCode)) {
			codes.append("&").append(actionCode);
		}
		
		String actionConfigCode = generateActionConfigCode(modelMetadata);
		if(StringUtils.isNotBlank(actionConfigCode)) {
			codes.append("&").append(actionConfigCode);
		}
		
		String actionValidationCode = generateActionValidationCode(modelMetadata);
		if(StringUtils.isNotBlank(actionValidationCode)) {
			codes.append("&").append(actionValidationCode);
		}
		
		return codes.toString();
	}
	
	/**
	 * <p>
	 * Title：Action
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.Struts2Generator#generateActionCode(xgenerator.model.ModelMetadata)
	 */
	public String generateActionCode(ModelMetadata modelMetadata) {
		String packagePrefixPath = buildPackagePath(modelMetadata.getPackagePrefix());
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String actionFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getSrc() + File.separator + packagePrefixPath + File.separator + subsystemPackagePath + File.separator + WEB_DIR + File.separator + STRUTS2_DIR + File.separator + ACTION_DIR;
		String actionFileName = modelMetadata.getJavaModelNameUpperCamelCase() + modelMetadata.getActionSuffer() + JAVA_EXT;
		
		String template = JAVA_TEMPLATE_PATH + "/Action.ftl";
		return "@" + generateCode(modelMetadata, template, actionFilePath, actionFileName);
	}

	/**
	 * <p>
	 * Title：ActionConfig
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.Struts2Generator#generateActionConfigCode(xgenerator.model.ModelMetadata)
	 */
	public String generateActionConfigCode(ModelMetadata modelMetadata) {
		String strutsConfigFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getWebConfig();
		String strutsConfigFileName = STRUTS2_CONFIG_PREFIX + modelMetadata.getJavaModelNameLowerCamelCase() + XML_EXT;
		
		String template = XML_TEMPLATE_PATH + "/StrutsConfig.ftl";
		return "@" + generateCode(modelMetadata, template, strutsConfigFilePath, strutsConfigFileName);
	}
	
	/**
	 * <p>
	 * Title：生成Action验证代码
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.Struts2Generator#generateActionValidateCode(xgenerator.model.ModelMetadata)
	 */
	public String generateActionValidationCode(ModelMetadata modelMetadata) {
		String packagePrefixPath = buildPackagePath(modelMetadata.getPackagePrefix());
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String validationFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getSrc() + File.separator + packagePrefixPath + File.separator + subsystemPackagePath + File.separator + WEB_DIR + File.separator + STRUTS2_DIR + File.separator + ACTION_DIR;
		String validationFileName = modelMetadata.getJavaModelNameUpperCamelCase() + "-validation" + XML_EXT;
		
		String template = XML_TEMPLATE_PATH + "/Validation.ftl";
		return "@" + generateCode(modelMetadata, template, validationFilePath, validationFileName);
	}

	/**
	 * <p>
	 * Title：生成业务层代码
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.AppGenerator#generateAppCode(xgenerator.model.ModelMetadata)
	 */
	public String generateAppCode(ModelMetadata modelMetadata) {
		StringBuffer codes = new StringBuffer();
		
		String serviceCode = generateServiceCode(modelMetadata);
		if(StringUtils.isNotBlank(serviceCode)) {
			codes.append("&").append(serviceCode);
		}
		
		String serviceImplCode = generateServiceImplCode(modelMetadata);
		if(StringUtils.isNotBlank(serviceImplCode)) {
			codes.append("&").append(serviceImplCode);
		}
		
		String modelCode = generateModelCode(modelMetadata);
		if(StringUtils.isNotBlank(modelCode)) {
			codes.append("&").append(modelCode);
		}
		
		String springConfigCode = generateSpringConfigCode(modelMetadata);
		if(StringUtils.isNotBlank(springConfigCode)) {
			codes.append("&").append(springConfigCode);
		}

		return codes.toString();
	}
	
	/**
	 * <p>
	 * Title：Service
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.ServiceGenerator#generateServiceCode(xgenerator.model.ModelMetadata)
	 */
	public String generateServiceCode(ModelMetadata modelMetadata) {
		String packagePrefixPath = buildPackagePath(modelMetadata.getPackagePrefix());
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String serviceFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getSrc() + File.separator + packagePrefixPath + File.separator + subsystemPackagePath + File.separator + SERVICE_DIR;
		String serviceFileName = modelMetadata.getJavaModelNameUpperCamelCase() + modelMetadata.getServiceSuffer() + JAVA_EXT;
		
		String template = JAVA_TEMPLATE_PATH + "/Service.ftl";
		return "@" + generateCode(modelMetadata, template, serviceFilePath, serviceFileName);
	}
	
	/**
	 * <p>
	 * Title：ServiceImpl
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.ServiceGenerator#generateServiceImplCode(xgenerator.model.ModelMetadata)
	 */
	public String generateServiceImplCode(ModelMetadata modelMetadata) {
		String packagePrefixPath = buildPackagePath(modelMetadata.getPackagePrefix());
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String serviceImplFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getSrc() + File.separator + packagePrefixPath + File.separator + subsystemPackagePath + File.separator + SERVICE_DIR + File.separator + SERVICE_IMPL_DIR;
		String serviceImplFileName = modelMetadata.getJavaModelNameUpperCamelCase() + modelMetadata.getServiceImplSuffer() + JAVA_EXT;
		
		String template = JAVA_TEMPLATE_PATH + "/ServiceImpl.ftl";
		return "@" + generateCode(modelMetadata, template, serviceImplFilePath, serviceImplFileName);
	}
	
	/**
	 * <p>
	 * Title：ModelBean
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.ServiceGenerator#generateModelCode(xgenerator.model.ModelMetadata)
	 */
	public String generateModelCode(ModelMetadata modelMetadata) {
		String packagePrefixPath = buildPackagePath(modelMetadata.getPackagePrefix());
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String modelFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getSrc() + File.separator + packagePrefixPath + File.separator + subsystemPackagePath + File.separator + MODEL_DIR;
		String modelFileName = modelMetadata.getJavaModelNameUpperCamelCase() + JAVA_EXT;
		
		String template = JAVA_TEMPLATE_PATH + "/Model.ftl";
		return "@" + generateCode(modelMetadata, template, modelFilePath, modelFileName);
	}

	/**
	 * <p>
	 * Title：SpringConfig
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.SpringGenerator#generateSpringConfigCode(xgenerator.model.ModelMetadata)
	 */
	public String generateSpringConfigCode(ModelMetadata modelMetadata) {
		String serviceConfigFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getAppConfig();
		String serviceConfigFileName = SPRING_CONFIG_PREFIX + modelMetadata.getJavaModelNameLowerCamelCase() + XML_EXT;
		
		String template = XML_TEMPLATE_PATH + "/ApplicationContext.ftl";
		return "@" + generateCode(modelMetadata, template, serviceConfigFilePath, serviceConfigFileName);
	}

	/**
	 * <p>
	 * Title：生成持久层代码
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.PersistenceGenerator#generatePersistenceCode(xgenerator.model.ModelMetadata)
	 */
	public String generatePersistenceCode(ModelMetadata modelMetadata) {
		StringBuffer codes = new StringBuffer();
		
		String daoCode = generateDaoCode(modelMetadata);
		if(StringUtils.isNotBlank(daoCode)) {
			codes.append("&").append(daoCode);
		}
		
		String daoImplCode = generateDaoImplCode(modelMetadata);
		if(StringUtils.isNotBlank(daoImplCode)) {
			codes.append("&").append(daoImplCode);
		}
		
		String entityCode = generateEntityCode(modelMetadata);
		if(StringUtils.isNotBlank(entityCode)) {
			codes.append("&").append(entityCode);
		}
		
		String entityConfigCode = generateEntityConfigCode(modelMetadata);
		if(StringUtils.isNotBlank(entityConfigCode)) {
			codes.append("&").append(entityConfigCode);
		}
		
		String metadataCode = generateMetadataCode(modelMetadata);
		if(StringUtils.isNotBlank(metadataCode)) {
			codes.append("&").append(metadataCode);
		}
		
		
		return codes.toString();
	}

	/**
	 * <p>
	 * Title：Dao
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.DaoGenerator#generateDaoCode(xgenerator.model.ModelMetadata)
	 */
	public String generateDaoCode(ModelMetadata modelMetadata) {
		String packagePrefixPath = buildPackagePath(modelMetadata.getPackagePrefix());
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String daoFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getSrc() + File.separator + packagePrefixPath + File.separator + subsystemPackagePath + File.separator + DAO_DIR;
		String daoFileName = modelMetadata.getJavaModelNameUpperCamelCase() + modelMetadata.getDaoSuffer() + JAVA_EXT;
		
		String template = JAVA_TEMPLATE_PATH + "/Dao.ftl";
		return "@" + generateCode(modelMetadata, template, daoFilePath, daoFileName);
	}

	/**
	 * <p>
	 * Title：DaoImpl
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.DaoGenerator#generateDaoImplCode(xgenerator.model.ModelMetadata)
	 */
	public String generateDaoImplCode(ModelMetadata modelMetadata) {
		String packagePrefixPath = buildPackagePath(modelMetadata.getPackagePrefix());
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String daoImplFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getSrc() + File.separator + packagePrefixPath + File.separator + subsystemPackagePath + File.separator + DAO_DIR + File.separator + DAO_HIBERNATE_IMPL_DIR;
		String daoImplFileName = modelMetadata.getJavaModelNameUpperCamelCase() + modelMetadata.getDaoImplSuffer() + JAVA_EXT;
		
		String template = JAVA_TEMPLATE_PATH + "/DaoHibernateImpl.ftl";
		return "@" + generateCode(modelMetadata, template, daoImplFilePath, daoImplFileName);
	}
	
	/**
	 * <p>
	 * Title：Entity
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.HibernateGenerator#generateEntityCode(xgenerator.model.ModelMetadata)
	 */
	public String generateEntityCode(ModelMetadata modelMetadata) {
		String packagePrefixPath = buildPackagePath(modelMetadata.getPackagePrefix());
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String entityFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getSrc() + File.separator + packagePrefixPath + File.separator + subsystemPackagePath + File.separator + ENTITY_DIR;
		String entityFileName = modelMetadata.getJavaModelNameUpperCamelCase() + JAVA_EXT;
		
		String template = JAVA_TEMPLATE_PATH + "/Entity.ftl";
		return "@" + generateCode(modelMetadata, template, entityFilePath, entityFileName);
	}

	/**
	 * <p>
	 * Title：EntityConfig
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.HibernateGenerator#generateEntityConfigCode(xgenerator.model.ModelMetadata)
	 */
	public String generateEntityConfigCode(ModelMetadata modelMetadata) {
		String packagePrefixPath = buildPackagePath(modelMetadata.getPackagePrefix());
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String entityConfigFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getSrc() + File.separator + packagePrefixPath + File.separator + subsystemPackagePath + File.separator + ENTITY_DIR;
		String entityConfigFileName = modelMetadata.getJavaModelNameUpperCamelCase() + ENTITY_CONFIG_SUFFER + XML_EXT;
		
		String template = XML_TEMPLATE_PATH + "/Entity.hbm.ftl";
		return "@" + generateCode(modelMetadata, template, entityConfigFilePath, entityConfigFileName);
	}
	
	/**
	 * <p>
	 * Title：生成元数据代码
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return
	 * @see xgenerator.generators.jgenerator.DaoGenerator#generateMetadataCode(xgenerator.model.ModelMetadata)
	 */
	public String generateMetadataCode(ModelMetadata modelMetadata) {
		String packagePrefixPath = buildPackagePath(modelMetadata.getPackagePrefix());
		String subsystemPackagePath = buildPackagePath(modelMetadata.getSubsystem());
		String metadataFilePath = modelMetadata.getProjectLocation() + File.separator + modelMetadata.getSrc() + File.separator + packagePrefixPath + File.separator + subsystemPackagePath + File.separator + METADATA_DIR;
		String metadataFileName = modelMetadata.getJavaModelNameUpperCamelCase() + modelMetadata.getMetadataSuffer() + JAVA_EXT;
		
		String template = JAVA_TEMPLATE_PATH + "/Metadata.ftl";
		return "@" + generateCode(modelMetadata, template, metadataFilePath, metadataFileName);
	}

}
